package chapter02.d02;
/*
 * synchronized没起作用
 * 
 */

public class Demo1 {
	public static void main(String[] args) {
		for (int i = 0; i < 3; i++) {
			Thread thread = new MyThread();
			thread.start();
		}
	}

}

class Test {
	public synchronized void test() {
		System.out.println("test开始..");
		try {
			Thread.sleep(1000);
		} catch (InterruptedException e) {
			e.printStackTrace();
		}
		System.out.println("test结束..");
	}
}

class MyThread extends Thread {

	public void run() {
		Test t = new Test();
		t.test();
	}
}
